package com.rcclabs.commonutils.gdata.docs.spreadsheet.services;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.spreadsheet.CellEntry;
import com.google.gdata.data.spreadsheet.CellFeed;
import com.google.gdata.data.spreadsheet.ListEntry;
import com.google.gdata.data.spreadsheet.ListFeed;
import com.google.gdata.data.spreadsheet.SpreadsheetEntry;
import com.google.gdata.data.spreadsheet.SpreadsheetFeed;
import com.google.gdata.data.spreadsheet.WorksheetEntry;
import com.google.gdata.util.ServiceException;
import com.rcclabs.commonutils.gdata.docs.service.DocumentListService;
import com.rcclabs.commonutils.gdata.exceptions.DocumentListException;

public interface GoogleSpreadsheetService extends DocumentListService {

	public DocumentListEntry create(String title) throws DocumentListException,
			MalformedURLException, IOException, ServiceException;

	public SpreadsheetFeed getSpreadsheetFeed() throws MalformedURLException,
			IOException, ServiceException;

	public List<SpreadsheetEntry> getSpreadsheetList()
			throws MalformedURLException, IOException, ServiceException;

	public SpreadsheetEntry getSpreadsheet(String key)
			throws MalformedURLException, IOException, ServiceException;

	// worksheet operations
	public WorksheetEntry getDefaultWorksheet(String key)
			throws MalformedURLException, IOException, ServiceException;

	public WorksheetEntry getWorksheet(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException;

	public List<WorksheetEntry> getWorksheetList(String key)
			throws MalformedURLException, IOException, ServiceException;

	public void insertWorksheet(String key, String title)
			throws MalformedURLException, IOException, ServiceException;

	public void insertWorksheet(String key, String title, int rows, int columns)
			throws MalformedURLException, IOException, ServiceException;

	// functions on cell-based feed
	public URL getCellFeedUrl(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public URL getCellFeedUrl(String key, int worksheetIndex, Integer minRow,
			Integer maxRow, Integer minColumn, Integer maxColumn)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public CellFeed getCellFeed(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public CellFeed getCellFeed(String key, int worksheetIndex, Integer minRow,
			Integer maxRow, Integer minColumn, Integer maxColumn)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public Set<String> getHeaders(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public List<CellEntry> getCells(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public void insertCell(String key, int worksheetIndex, CellEntry cell)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	// functions on list based-feed
	public URL getListFeedUrl(String key, int worksheetIndex, String query,
			boolean reverse, String orderBy) throws MalformedURLException,
			IOException, ServiceException, URISyntaxException;
	
	public ListFeed getListFeed(String key, int worksheetIndex, String query,
			boolean reverse, String orderBy) throws MalformedURLException,
			IOException, ServiceException, URISyntaxException;

	public List<ListEntry> getRows(String key, int worksheetIndex)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public List<ListEntry> getRows(String key, int worksheetIndex,
			String query, boolean reverse, String orderBy)
			throws MalformedURLException, IOException, ServiceException,
			URISyntaxException;

	public void insertRow(String key, int worksheetIndex,
			Map<String, String> elements) throws MalformedURLException,
			IOException, ServiceException, URISyntaxException;

	public void updateRow(String key, int worksheetIndex, int rowIndex,
			Map<String, String> elements) throws MalformedURLException,
			IOException, ServiceException, URISyntaxException;

}
